from htstool.models import *
from htstool.util import *
from htstool.plot import box

def draw(grp):
	dfs=[]
	for p in grp.plates:
		dfs.append(convert_to_one_col_df(p.data.dataframe, p.platename+' rep:'+str(p.replicate)))
	data=pd.concat(dfs, axis=1)
	box(data, title=grp.groupname, size=(50, 20), saveas=grp.groupname+' '+grp.platecommonattr['condition']+'.png')

if __name__=="__main__":
	nonrad_grp=PlateGroup.objects.get(groupname='RAW readout non-radiated plates')
	irrad_grp=PlateGroup.objects.get(groupname='RAW readout irradiated plates')
	
	norm_nonrad_grp=PlateGroup.objects.get(groupname='normalised plates perplate-z',  platecommonattr__condition='NR' )
	norm_irrad_grp=PlateGroup.objects.get(groupname='normalised plates perplate-z',  platecommonattr__condition='IR' )

	draw(nonrad_grp)
	draw(irrad_grp)
	draw(norm_nonrad_grp)
	draw(norm_irrad_grp)
	
	




